package com.cbs.android.module.userkit;

import com.cbs.android.module.userkit.activity.ForgotPasswordActivity;
import com.cbs.android.module.userkit.activity.InformationActivity;
import com.cbs.android.module.userkit.activity.LoginActivity;
import com.cbs.android.module.userkit.activity.ModifyPasswordActivity;
import com.cbs.android.module.userkit.activity.ModifyUserNameActivity;
import com.cbs.android.module.userkit.activity.QrCodeActivity;
import com.cbs.android.module.userkit.activity.RegisterActivity;
import com.cbs.android.module.userkit.fragment.BirthdayDialogFragment;
import com.cbs.android.module.userkit.fragment.NicknameDialogFragment;
import com.cbs.android.module.userkit.fragment.RealnameDialogFragment;
import com.cbs.android.module.userkit.fragment.SexDialogFragment;

/**
 * Created by broche on 11/13/15.
 */
public final class UserKitSetting {
    private static Class<ForgotPasswordActivity> forgotPasswordActivityClass = ForgotPasswordActivity.class;
    private static Class<InformationActivity> informationActivityClass = InformationActivity.class;
    private static Class<LoginActivity> loginActivityClass = LoginActivity.class;
    private static Class<ModifyPasswordActivity> modifyPasswordActivityClass = ModifyPasswordActivity.class;
    private static Class<ModifyUserNameActivity> modifyUserNameActivityClass = ModifyUserNameActivity.class;
    private static Class<QrCodeActivity> qrCodeActivityClass = QrCodeActivity.class;
    private static Class<RegisterActivity> registerActivityClass = RegisterActivity.class;
    private static Class<NicknameDialogFragment> nicknameDialogFragmentClass = NicknameDialogFragment.class;
    private static Class<RealnameDialogFragment> realnameDialogFragmentClass = RealnameDialogFragment.class;
    private static Class<SexDialogFragment> sexDialogFragmentClass = SexDialogFragment.class;
    private static Class<BirthdayDialogFragment> birthdayDialogFragmentClass = BirthdayDialogFragment.class;

    private static int avatarWidth = 512;
    private static int avatarHeight = 512;
    private static int homeImageWidth = 1024;
    private static int homeImageHeight = 512;
    private static ImagePathTranslator imagePathTranslator = null;
    private static String[] nicknameFilterKeywords = new String[0];
    private static boolean debug = false;

    public static Class<ForgotPasswordActivity> getForgotPasswordActivityClass() {
        return forgotPasswordActivityClass;
    }

    public static Class<InformationActivity> getInformationActivityClass() {
        return informationActivityClass;
    }

    public static Class<LoginActivity> getLoginActivityClass() {
        return loginActivityClass;
    }


    public static Class<ModifyPasswordActivity> getModifyPasswordActivityClass() {
        return modifyPasswordActivityClass;
    }

    public static Class<ModifyUserNameActivity> getModifyUserNameActivityClass() {
        return modifyUserNameActivityClass;
    }

    public static Class<QrCodeActivity> getQrCodeActivityClass() {
        return qrCodeActivityClass;
    }

    public static Class<RegisterActivity> getRegisterActivityClass() {
        return registerActivityClass;
    }

    public static Class<NicknameDialogFragment> getNicknameDialogFragmentClass() {
        return nicknameDialogFragmentClass;
    }

    public static Class<RealnameDialogFragment> getRealnameDialogFragmentClass() {
        return realnameDialogFragmentClass;
    }

    public static Class<SexDialogFragment> getSexDialogFragmentClass() {
        return sexDialogFragmentClass;
    }

    public static Class<BirthdayDialogFragment> getBirthdayDialogFragmentClass() {
        return birthdayDialogFragmentClass;
    }

    public static void registerClass(Class<?> aClass) {
        if (aClass == null) {
            return;
        }
        if (ForgotPasswordActivity.class.isAssignableFrom(aClass)) {
            forgotPasswordActivityClass = (Class<ForgotPasswordActivity>) aClass;
        } else if (InformationActivity.class.isAssignableFrom(aClass)) {
            informationActivityClass = (Class<InformationActivity>) aClass;
        } else if (LoginActivity.class.isAssignableFrom(aClass)) {
            loginActivityClass = (Class<LoginActivity>) aClass;
        } else if (ModifyPasswordActivity.class.isAssignableFrom(aClass)) {
            modifyPasswordActivityClass = (Class<ModifyPasswordActivity>) aClass;
        } else if (ModifyUserNameActivity.class.isAssignableFrom(aClass)) {
            modifyUserNameActivityClass = (Class<ModifyUserNameActivity>) aClass;
        } else if (QrCodeActivity.class.isAssignableFrom(aClass)) {
            qrCodeActivityClass = (Class<QrCodeActivity>) aClass;
        } else if (RegisterActivity.class.isAssignableFrom(aClass)) {
            registerActivityClass = (Class<RegisterActivity>) aClass;
        } else if (NicknameDialogFragment.class.isAssignableFrom(aClass)) {
            nicknameDialogFragmentClass = (Class<NicknameDialogFragment>) aClass;
        } else if (RealnameDialogFragment.class.isAssignableFrom(aClass)) {
            realnameDialogFragmentClass = (Class<RealnameDialogFragment>) aClass;
        } else if (SexDialogFragment.class.isAssignableFrom(aClass)) {
            sexDialogFragmentClass = (Class<SexDialogFragment>) aClass;
        } else if (BirthdayDialogFragment.class.isAssignableFrom(aClass)) {
            birthdayDialogFragmentClass = (Class<BirthdayDialogFragment>) aClass;
        }
    }

    public static int getAvatarWidth() {
        return avatarWidth;
    }

    public static void setAvatarWidth(int avatarWidth) {
        UserKitSetting.avatarWidth = avatarWidth;
    }

    public static int getAvatarHeight() {
        return avatarHeight;
    }

    public static void setAvatarHeight(int avatarHeight) {
        UserKitSetting.avatarHeight = avatarHeight;
    }

    public static int getHomeImageWidth() {
        return homeImageWidth;
    }

    public static void setHomeImageWidth(int homeImageWidth) {
        UserKitSetting.homeImageWidth = homeImageWidth;
    }

    public static int getHomeImageHeight() {
        return homeImageHeight;
    }

    public static void setHomeImageHeight(int homeImageHeight) {
        UserKitSetting.homeImageHeight = homeImageHeight;
    }

    public static ImagePathTranslator getImagePathTranslator() {
        return imagePathTranslator;
    }

    public static void setImagePathTranslator(ImagePathTranslator imagePathTranslator) {
        UserKitSetting.imagePathTranslator = imagePathTranslator;
    }

    public static String[] getNicknameFilterKeywords() {
        return nicknameFilterKeywords;
    }

    public static void setNicknameFilterKeywords(String[] nicknameFilterKeywords) {
        UserKitSetting.nicknameFilterKeywords = nicknameFilterKeywords;
    }

    public static boolean isDebug() {
        return debug;
    }

    public static void setDebug(boolean debug) {
        UserKitSetting.debug = debug;
    }
}
